<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="en" name="language">
	<title>shear</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link media="screen" href="../docutils-api.css" type="text/css" rel="stylesheet">

</head>

<body>

<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
  <input type="hidden" name="domains" value="www.graphicsmagick.org" />
  <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
</form>
</div>


<div class="navmenu">
<ul>
  <li><a href="../index.html">Home</a></li>
  <li><a href="../project.html">Project</a></li>
  <li><a href="../download.html">Download</a></li>
  <li><a href="../README.html">Install</a></li>
  <li><a href="../Hg.html">Source</a></li>
  <li><a href="../NEWS.html">News</a> </li>
  <li><a href="../utilities.html">Utilities</a></li>
  <li><a href="../programming.html">Programming</a></li>
  <li><a href="../reference.html">Reference</a></li>
</ul>
</div>

<main id="shear">
<h1 class="title">shear</h1>
<p class="subtitle" id="rotate-image-shear-image-or-apply-a-2d-affine-transformation">Rotate image, shear image, or apply a 2D affine transformation</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#affinetransformimage" id="id7">AffineTransformImage</a></p></li>
<li><p><a class="reference internal" href="#autoorientimage" id="id8">AutoOrientImage</a></p></li>
<li><p><a class="reference internal" href="#rotateimage" id="id9">RotateImage</a></p></li>
<li><p><a class="reference internal" href="#shearimage" id="id10">ShearImage</a></p></li>
</ul>
</div>
<section id="affinetransformimage">
<h1><a class="toc-backref" href="#id7">AffineTransformImage</a></h1>
<section id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *AffineTransformImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, <a class="reference external" href="../api/types.html#affinematrix">AffineMatrix</a> *affine,
                             <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="description">
<h2>Description</h2>
<p>AffineTransformImage() transforms an image as dictated by the affine matrix.
It allocates the memory necessary for the new Image structure and returns
a pointer to the new image.</p>
<p>The format of the AffineTransformImage method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *AffineTransformImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, <a class="reference external" href="../api/types.html#affinematrix">AffineMatrix</a> *affine,
                             <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>image:</dt>
<dd><p>The image.</p>
</dd>
<dt>affine:</dt>
<dd><p>The affine transform.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="autoorientimage">
<h1><a class="toc-backref" href="#id8">AutoOrientImage</a></h1>
<section id="id1">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *AutoOrientImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const OrientationType current_orientation,
                        <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id2">
<h2>Description</h2>
<p>AutoOrientImage() returns an image adjusted so that its orientation is
suitable for viewing (i.e. top-left orientation).</p>
<p>The format of the AutoOrientImage method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *AutoOrientImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const OrientationType current_orientation,
                        <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>image:</dt>
<dd><p>The image.</p>
</dd>
<dt>current_orientation:</dt>
<dd><p>Current image orientation (normally same as
image-&gt;orientation).</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="rotateimage">
<h1><a class="toc-backref" href="#id9">RotateImage</a></h1>
<section id="id3">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *RotateImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const double degrees,
                    <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id4">
<h2>Description</h2>
<p>Method RotateImage creates a new image that is a rotated copy of an
existing one.  Positive angles rotate counter-clockwise (right-hand rule),
while negative angles rotate clockwise.  Rotated images are usually larger
than the originals and have 'empty' triangular corners.  X axis.  Empty
triangles left over from shearing the image are filled with the color
specified by the image background_color.  RotateImage allocates the memory
necessary for the new Image structure and returns a pointer to the new
image.</p>
<p>Method RotateImage is based on the paper &quot;A Fast Algorithm for General
Raster Rotatation&quot; by Alan W. Paeth.  RotateImage is adapted from a similar
method based on the Paeth paper written by Michael Halle of the Spatial
Imaging Group, MIT Media Lab.</p>
<p>The format of the RotateImage method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *RotateImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const double degrees,
                    <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>status:</dt>
<dd><p>Method RotateImage returns a pointer to the image after
rotating.  A null image is returned if there is a memory shortage.</p>
</dd>
<dt>image:</dt>
<dd><p>The image;  returned from
ReadImage.</p>
</dd>
<dt>degrees:</dt>
<dd><p>Specifies the number of degrees to rotate the image.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="shearimage">
<h1><a class="toc-backref" href="#id10">ShearImage</a></h1>
<section id="id5">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *ShearImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const double x_shear, const double y_shear,
                   <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id6">
<h2>Description</h2>
<p>Method ShearImage creates a new image that is a shear_image copy of an
existing one.  Shearing slides one edge of an image along the X or Y
axis, creating a parallelogram.  An X direction shear slides an edge
along the X axis, while a Y direction shear slides an edge along the Y
axis.  The amount of the shear is controlled by a shear angle.  For X
direction shears, x_shear is measured relative to the Y axis, and
similarly, for Y direction shears y_shear is measured relative to the
X axis.  Empty triangles left over from shearing the image are filled
with the color defined by the pixel at location (0,0).  ShearImage
allocates the memory necessary for the new Image structure and returns
a pointer to the new image.</p>
<p>Method ShearImage is based on the paper &quot;A Fast Algorithm for General
Raster Rotatation&quot; by Alan W. Paeth.</p>
<p>The format of the ShearImage method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *ShearImage( const <a class="reference external" href="../api/types.html#image">Image</a> *image, const double x_shear, const double y_shear,
                   <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>status:</dt>
<dd><p>Method ShearImage returns a pointer to the image after
rotating.  A null image is returned if there is a memory shortage.</p>
</dd>
<dt>image:</dt>
<dd><p>The image;  returned from
ReadImage.</p>
</dd>
<dt>x_shear, y_shear:</dt>
<dd><p>Specifies the number of degrees to shear the image.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
</main>


<hr class="docutils">
<div class="document">
    <p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>

</main>
</body>
</html>
